Conditions | 2 |
Paths | 8 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict' |
||
7 | function runProcess (script, callback, basePath) { |
||
8 | var opts = { |
||
9 | silent: true, |
||
10 | async: true |
||
11 | } |
||
12 | if (basePath) { |
||
13 | opts.cwd = path.resolve(basePath) |
||
14 | } |
||
15 | |||
16 | var process = childProcess.exec(script, opts) |
||
17 | output.logComponent('Script', 'blue', 'Executing "' + script + '"') |
||
18 | process.on('exit', function (code) { |
||
19 | code = parseInt(code, 10) || code |
||
20 | output.logComponent('Script', code === 0 ? 'blue' : 'red', 'Exited with code ' + code) |
||
21 | if (callback) { |
||
22 | callback(code) |
||
23 | } |
||
24 | }) |
||
25 | process.stderr.on('data', function (message) { |
||
26 | output.logComponent('Script', 'red', message) |
||
27 | }) |
||
28 | process.stdout.on('data', function (message) { |
||
29 | output.logComponent('Script', 'blue', message) |
||
30 | }) |
||
31 | } |
||
32 | |||
36 |